import { lazy } from "react";

import Home from "../pages/home/Index";
import Login from "../pages/login/Index";
import Error from "../pages/error/Index";
import { Navigate } from "react-router-dom";

let Index = lazy(() => import("../pages/index/Index"));
let Indexx = lazy(() => import("../pages/index/indexx/Index"));
let User = lazy(() => import("../pages/user/Index"));

export const homee = [
  {
    path: "/home/index",
    element: <Index></Index>,
    title: "首页",
    children: [
      {
        path: "/home/index/indexx",
        element: <Indexx></Indexx>,
        title: "三级路由",
      },
    ],
  },
  {
    path: "/home/user",
    element: <User></User>,
    title: "后台管理",
  },
];

const home = [
  {
    path: "/",
    element: <Navigate to={"/home/index"}></Navigate>,
  },
  {
    path: "/home",
    element: <Home></Home>,
    children: homee,
  },
  {
    path: "/login",
    element: <Login></Login>,
  },
  {
    path: "*",
    element: <Error></Error>,
  },
];
export default home;
